package com.losdun.common.utils.http;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @Description
 * @Author Sword.Ye
 * @Date 2025/8/22
 **/
@Slf4j
public class LosdunHttpUtils {

    public static String sendFormGet(String url, Map<String,String> headers,Map<String,Object> parameters) {
        return HttpUtil.createGet(url).addHeaders(headers).form(parameters).execute().body();
    }

    public static String sendFormPost(String url, Map<String,String> headers,Map<String,Object> parameters) {
        return HttpUtil.createPost(url).addHeaders(headers).form(parameters).execute().body();
    }

    public static String sendPost(String url, Map<String,String> headers,String body) {
        return HttpRequest.post(url).addHeaders(headers).body(body).execute().body();
    }
}
